@@ -51,7 +51,7 @@ module Agents |
||
51 | 51 |
{ |
52 | 52 |
"path": "{{date.pretty}}", |
53 | 53 |
"regexp": "\\A(?<time>\\d\\d:\\d\\d [AP]M [A-Z]+)", |
54 |
- "to": "pretty_date", |
|
54 |
+ "to": "pretty_date" |
|
55 | 55 |
} |
56 | 56 |
] |
57 | 57 |
} |
@@ -61,7 +61,7 @@ module Agents |
||
61 | 61 |
"pretty_date": { |
62 | 62 |
"time": "10:00 PM EST", |
63 | 63 |
"0": "10:00 PM EST on January 11, 2013" |
64 |
- "1": "10:00 PM EST", |
|
64 |
+ "1": "10:00 PM EST" |
|
65 | 65 |
} |
66 | 66 |
|
67 | 67 |
So you can use it in `instructions` like this: |
@@ -62,7 +62,7 @@ module Agents |
||
62 | 62 |
.... |
63 | 63 |
}, |
64 | 64 |
'agent_id' => 1234, |
65 |
- 'event_id' => 3432, |
|
65 |
+ 'event_id' => 3432 |
|
66 | 66 |
} |
67 | 67 |
MD |
68 | 68 |
|
@@ -42,20 +42,20 @@ module Agents |
||
42 | 42 |
|
43 | 43 |
"extract": { |
44 | 44 |
"word": { "regexp": "^(.+?): (.+)$", index: 1 }, |
45 |
- "definition": { "regexp": "^(.+?): (.+)$", index: 2 }, |
|
45 |
+ "definition": { "regexp": "^(.+?): (.+)$", index: 2 } |
|
46 | 46 |
} |
47 | 47 |
|
48 | 48 |
Or if you prefer names to numbers for index: |
49 | 49 |
|
50 | 50 |
"extract": { |
51 | 51 |
"word": { "regexp": "^(?<word>.+?): (?<definition>.+)$", index: 'word' }, |
52 |
- "definition": { "regexp": "^(?<word>.+?): (?<definition>.+)$", index: 'definition' }, |
|
52 |
+ "definition": { "regexp": "^(?<word>.+?): (?<definition>.+)$", index: 'definition' } |
|
53 | 53 |
} |
54 | 54 |
|
55 | 55 |
To extract the whole content as one event: |
56 | 56 |
|
57 | 57 |
"extract": { |
58 |
- "content": { "regexp": "\A(?m:.)*\z", index: 0 }, |
|
58 |
+ "content": { "regexp": "\A(?m:.)*\z", index: 0 } |
|
59 | 59 |
} |
60 | 60 |
|
61 | 61 |
Beware that `.` does not match the newline character (LF) unless the `m` flag is in effect, and `^`/`$` basically match every line beginning/end. See [this document](http://ruby-doc.org/core-#{RUBY_VERSION}/doc/regexp_rdoc.html) to learn the regular expression variant used in this service. |